﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UserService.Entity;
using UserService.Repository;

namespace UserService.Business
{
    public class ClientBusiness : IDisposable
    {
        private DBContext _ctx;
        private ClientManager<Client> _clientManager;

        public ClientBusiness()
        {
            _ctx = new DBContext();
            _clientManager = new ClientManager<Client>(new ClientStore(_ctx));
        }

        public Client FindClient(string clientId)
        {
            Client obj_Client = _clientManager.FindByIdToClient(clientId);
            return obj_Client;
        }

        public bool InstertClient(Client obj)
        {
            return _clientManager.AddClient(obj);
        }

        public void Dispose()
        {
            _ctx.Dispose();
            _clientManager.Dispose();
        }
    }
}
